package com.fany.views.circlemenu;

import com.fany.fastsearcher.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.PointF;
import com.fany.utils.BitmapHelper;

public class CircleMenuControlButton
{
	private CircleArea _centerButtonArea;

	private PointF _centerPoint;
	private float _radius;

	private Context _context;

	public CircleMenuControlButton(Context context, PointF centerPoint, float radius)
	{
		_context = context;
		_centerPoint = new PointF(centerPoint.x, centerPoint.y);
		_radius = radius;
		_centerButtonArea = new CircleArea();
		adjustArea();
	}

	private void adjustArea()
	{
		_centerButtonArea.adjustArea(_centerPoint, _radius);
		PointF point = new PointF(_centerPoint.x, _centerPoint.y - _radius / 2);
	}

	public boolean isPointInButton(float x, float y)
	{

		return _centerButtonArea.isPointInArea(x, y);

	}

	public void draw(Canvas canvas)
	{
		Bitmap runBitmap = BitmapHelper.loadBitmapResource(R.drawable.ok);
        runBitmap = BitmapHelper.toRoundCorner(runBitmap, runBitmap.getHeight());
		canvas.drawBitmap(runBitmap, null, _centerButtonArea.area, null);
	}
}
